import JSEncrypt from 'jsencrypt'

// 公钥
const publicKey = `-----BEGIN PUBLIC KEY-----
MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDLQuEDD7iHXE4glSJ94v2Mqekq
Mvg+OgqaEePy89G05Ne5BuEJPh/p6GyT7+rEVIK5TIEo0UOgEa2qfOE8BG8eTUgk
6/xQIpnSw/PUL61uYybtfTZU0sgENTJHwynZOT0gv6rG1dmXKcDPkRrjbYj3hznZ
9PxC7op3wq4UZ/caOQIDAQAB
-----END PUBLIC KEY-----`

// 使用公钥加密
export function encryptPassword(password) {
  const encrypt = new JSEncrypt()
  encrypt.setPublicKey(publicKey)
  return encrypt.encrypt(password)
}
